<?php

HBase::using('DAL.HPages');
HBase::using('DAL.HPagesModules');
HBase::using('DAL.HModules');
HBase::using('DAL.HModulesInstances');

class HLayout {
	public function loadModulesToPanes($alias, $panename) {			
		// Get Page ID
		$page_id = HPages::getPageIdByAlias($alias);				
		// Get page modules
		$modules = HPages::getModulesByPane($page_id, $panename);
		
		// Render
		if (count($modules) != 0) {
			for ($i = 0; $i < count($modules); $i++) {
				$name = HModules::getModuleNameById($modules[$i]['module_instance_id']);			
require_once(SYSTEM_PATH.SEPARATOR.'modules'.SEPARATOR.$name.SEPARATOR.HModulesInstances::getViewFileById($modules[$i]['module_instance_id']));
			}
		}		
	}
}